<template>
    <div class="wiper">
        <Filter title="拣配单详细" :items="filterItems" :model="condition" />
        <Table :buttons="buttons" :columns="columns" :data="data" :pagination="condition" />
    </div>
</template>
<script>
import { message, Modal } from "ant-design-vue";
import Filter from "@/components/Filter";
import Table from "@/components/Table";
import { detailPager } from "@/api/order/picking";
import {
    ColumnProps, FilterItems, FilterCondition
} from "./config";
import {Base64} from 'js-base64';

export default {
    name: 'picking-detail',
    data() {
        return {
            filterItems: FilterItems,
            data: [{}],
            columns: ColumnProps,
            condition: FilterCondition
        }
    },
    components: {
        Filter,
        Table
    },
    mounted() {
        this._details(this.$route.query);
    },
    methods: {
        /**
         * 加载数据
         */
        load() {
            detailPager({...this.condition, pickId: this.pick}).then(res => {
                this.data = res.data.rows;
                this.condition.total = res.data.total;
            })
        },

        /**
             *
             * 查询详细
             */
        _details(query){
            this.pick = JSON.parse(Base64.decode(Object.keys(query).map(item => query[item]).join(""))).id;
            detailPager({...this.condition, pickId: this.pick}).then(res => {
                this.data = res.data.rows;
                this.condition.total = res.data.total;
            })
        },

        _rename(list) {
            return list.map(item => {
                return { label: item.name, value: item.id, children: this._rename(item.children) }
            });
        },

    }
}
</script>
<style></style>
